package com.sale24h.data.adapter;

import java.util.List;

import com.example.sale24h.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class SpinnerItemAdapter<T> extends ArrayAdapter<T>
{
	private Context context;
	private List<T> lstValues;

	public SpinnerItemAdapter(Context context, List<T> objects)
	{
		super(context, R.layout.spinner_item_layout, objects);
		this.context=context;
		lstValues=objects;
		// TODO Auto-generated constructor stub
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent)
	{
		LayoutInflater inflater = (LayoutInflater)this.context
		        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		
		View rootView=inflater.inflate(R.layout.spinner_item_layout, parent,false);
		
		TextView tbxItemText=(TextView)rootView.findViewById(R.id.tbxSpinnerItemText);
		
		tbxItemText.setText(lstValues.get(position).toString());		
		
		return rootView;

	}

}
